/*
 * Created by SharpDevelop.
 * User: Tivadar Papai
 * Date: 8/28/2007
 * Time: 9:32 AM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;

namespace RoverStudio.Common.WorldModel
{
    public class WorldModelObjectEventArgs : EventArgs
    {
        public WorldModelObject worldModelObject;
        public DateTime time;

        public WorldModelObjectEventArgs(WorldModelObject worldModelObject, DateTime time)
        {
            this.worldModelObject = worldModelObject;
            this.time = time;
        }

    }

    public delegate void ObjectChangedHandle(object sender, WorldModelObjectEventArgs wmea);

    /// <summary>
    /// Description of WorldModelObject.
    /// </summary>
    public class WorldModelObject
    {
        private string name;

        public string Name
        {
            get { return name; }
        }

        public event ObjectChangedHandle ObjectChanged;

        private WorldModel worldModel;

        public WorldModel WorldModel
        {
            get { return worldModel; }
            set { worldModel = value; }
        }

        public WorldModelObject(string name, WorldModel worldModel)
        {
            this.name = name;
            this.worldModel = worldModel;
            worldModel.AddWorldModelObject(this);

        }

        protected void WorldObjectChanged()
        {
            if (ObjectChanged != null)
                ObjectChanged(this, new WorldModelObjectEventArgs(this, DateTime.Now));
        }

    }
}
